<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta name="viewport" id="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no"/>
<link href="./css/reset.css" rel="stylesheet" type="text/css"/>
<link href="./css/goods-details.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class="near-box" style="width: 100%;height: 100%;">
	<div class="gdetails-header">
		<a href="./index.jsp" class="gdetails-hleft"></a>
		<div class="gdetails-htbox">
			商品详情
		</div>
		<!-- <span class="gdetails-hshare"></span> -->
	</div>

	<!-- 轮播图 -->
	<div class="gdetails-bigbox">
		 <!--轮播部分-->
		<div id="slideBox" class="slideBox"style="margin-top: 52px;">
		  <div class="index-bigbox">
		  <!--轮播开始-->
		  <div id="slideBox" class="slideBox">
			<div class="bd" id="bd">
				<ul class="shopdatails" style="margin-top:3.25rem;">
					<!-- <li>
						<a class="pic" href="#"><img id="selectHomeRotary0" src=""/></a>
					</li>
					<li>
						<a class="pic" href="#"><img id="selectHomeRotary1" src=""/></a>
					</li>
					<li>
						<a class="pic" href="#"><img id="selectHomeRotary2" src=""/></a>
					</li>
					<li>
						<a class="pic" href="#"><img id="selectHomeRotary3" src=""/></a>
					</li>-->
				</ul>
			</div>
			<div class="hd">
				<ul></ul>
			</div>
		  </div>
		</div>
	    <!--轮播部分-->
	    <!--商品价格部分-->
	    <div class="gdetails-price">
	    	 <div class="gdetails-price-box1">
	    	 	  <span class="gdetails-price-text1">￥</span>
	    	 	  <img alt="" src="images/server.png" onclick="callOnlineService()" style="float: right;width: 30px; height: 30px; margin-top: 4px;">
	    	 </div>
	    	 <div class="gdetails-price-box1">
	    	 	  <div class="gdetails-price-text5"></div>
	    	 </div>
	    	 <div class="gdetails-price-box1">
	    	 	  <div class="gdetails-price-text6">商品规格：<span style="color:#FFB34E";>袋</span></div>
	    	 </div>
	    </div>

	    <!-- 快递等信息的图 -->
	    <div style="width: 100%;background: white;text-align: center;padding:0 0 1rem;"><img alt="" src="./images/express.png" style="width: 90%;"></div>
	    <!--商品价格部分-->
	    <!--分享弹层部分-->
	    <!--弹层背景部分-->
	    <div class="gdetails-layer-bg" style="display: none;"></div>
	    <div class="gd-share-layer" style="display: none;">
	    	<div class="gd-share-layer-box1">分享</div>
	    	<div class="gd-share-layer-box2">
	    		<span class="gd-share-layer-img1"><img src="./images/icon_qq.png"></span>
	    		<span class="gd-share-layer-text1">QQ</span>
	    	</div>
	    	<div class="gd-share-layer-box2">
	    		<span class="gd-share-layer-img1"><img src="./images/icon_weichat.png"></span>
	    		<span class="gd-share-layer-text1">微信</span>
	    	</div>
	    	<div class="gd-share-layer-box2">
	    		<span class="gd-share-layer-img1"><img src="./images/icon_qzone.png"></span>
	    		<span class="gd-share-layer-text1">QQ空间</span>
	    	</div>
	    	<div class="gd-share-layer-box2">
	    		<span class="gd-share-layer-img1"><img src="./images/icon_xinlang.png"></span>
	    		<span class="gd-share-layer-text1">新浪微博</span>
	    	</div>
	    	<div class="gd-share-layer-box2">
	    		<span class="gd-share-layer-img1"><img src="./images/icon_douban.png"></span>
	    		<span class="gd-share-layer-text1">豆瓣网</span>
	    	</div>
	    	<div class="gd-share-layer-box2">
	    		<span class="gd-share-layer-img1"><img src="./images/icon_zhifubao.png"></span>
	    		<span class="gd-share-layer-text1">支付宝</span>
	    	</div>
	    </div>
	    <!--分享弹层部分-->
	    <!--图文详情部分-->
	    <div class="recommend-box1">商品详情</div>
	    <div class="recommend-box2">
	    	<span class="recommend-box2-text1"></span>
	    </div>
    	<!-- <div class="recommend-box1">图文详情</div> -->
    	<div class="image-text-xq-img"></div>
	    <!--图文详情部分-->
	</div>
	<!--加入购物车部分-->
	<div class="goods-details-bottom">
		<!-- <div class="gd-collect">
			<a href="./index.jsp">
				<span class="gd-collect-img1"></span>
				<span class="gd-collect-text1">分享</span>
			</a>
		</div>
		<div class="gd-collect" id="jumpService" onclick="jumpService()">
			<a>
				<span class="gd-collect-img3"></span>
				<span class="gd-collect-text2">客服</span>
			</a>
		</div> -->
		<a href="./shoping-cart.jsp" class="gd-collect">
			<span class="gd-collect-img1 img2">
				<img src="images/shop-cart3.png" width=25 height=25 />
				<i class="add-num" style="margin-left:1rem; margin-top: -35px;">0</i>
			</span>
			<span class="gd-collect-text3">购物车</span>
		</a>
		<button class="gd-collect-btn1 addcar" onclick="insertOrder()">加入购物车</button>
		<button class="gd-collect-btn1 btn2" onclick="pay()">立即购买</button>
	</div>
</div>
</div>

<input  type="hidden" value="<%=request.getParameter("cid")%>" id="cid">
<!-- <script src="./js/TouchSlide.1.1.js"></script> -->
<script src="./js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="js/TouchSlide.1.1.js"></script>
<script type="text/javascript" src="./js/ydui.citys.js"></script>
<script type="text/javascript" src="./js/ydui.js"></script>
<script src="./js/goods-details.js"></script>
<script type="text/javascript">

	var onlineService = "";

	$(function(){
		findByIdDatails();
	})
	
	function findByIdDatails(){
		var a=$("#cid").val();
		$.post("../../../tszs/txr/findByIdDatails.do?cid="+a,function(data){
			
			var poj = data.data[0];
			
		    $(".gdetails-price-text1").html(poj.cPrice+"￥");
			$(".gdetails-price-text5").html(poj.cName);
			$(".recommend-box2-text1").html("<i>详情描述： </i>"+poj.cDescribe);
			$(".image-text-xq-img").html("<img src="+poj.cPhtotoDescribe+">");
			$(".shopdatails").html(poj.cPhtoto);
			
			onlineService = poj.onlineService;

			if(poj.cNum==""){

			}else{
				$(".add-num").css("display","block")
				$(".add-num").html(poj.cNum);
			}

			TouchSlide({
			    slideCell:"#slideBox",
			    titCell:".hd ul", //开启自动分页 autoPage:true ，此时设置 titCell 为导航元素包裹层
			    mainCell:".bd ul",
			    effect:"leftLoop",
			    autoPage:true,//自动分页
			    autoPlay:true //自动播放
			});
		},"json")
	}
	
	/*加入购物车*/
	$(function() {
	     var addNumText = parseInt($(".add-num").text());
	     if (addNumText==0) {
	          $(".add-num").hide();
	     }
	     $(".addcar").click(function(event){
	          $(".add-num").show();
	          var addNumText = parseInt($(".add-num").text());
	          addNumText++;
	          $(".add-num").text(addNumText);
	     });
	});
	
	//立即购买
	function pay(){
		var num=$(".add-num").text();
		num++;
		var shopId=$("#cid").val();
		var pid="";
	 	$.post("../../../tszs/txr/insertOrder.do?shopId="+shopId+"&num="+1+"&pStatic=1",function(data){
			window.location.href="indent-details.jsp?type=1&cid="+data.data[0];
		},"json")
	}

	function insertOrder(){
		var num=$(".add-num").text();
		num++;
		var shopId=$("#cid").val();
	 	$.post("../../../tszs/txr/insertOrder.do?shopId="+shopId+"&num="+num+"&pStatic=0",function(data){
		},"json")
	}
	
	function callOnlineService() {
		window.location.href = 'http://t.ibangkf.com/i/chat-'+onlineService+'.html?l='+onlineService;
	}
</script>
</body>
</html>
